#include "lib_rtmp_util.h"

JNIEXPORT jint JNICALL
Java_com_linciping_rtmputil_RtmpOutputPicture_connectionRtmp(JNIEnv *env, jclass clazz, jstring rtmp_url, jstring picture_path
        , jint width,jint height) {
    const char *rtmpUrl = jstringToString(env, rtmp_url);
    const char *picturePath = jstringToString(env, picture_path);
    return connectionRtmp(rtmpUrl, picturePath,width,height);
}

JNIEXPORT jint JNICALL
Java_com_linciping_rtmputil_RtmpOutputPicture_closeRtmp(JNIEnv *env, jclass clazz, jstring rtmp_url) {
    const char *rtmpUrl = jstringToString(env, rtmp_url);
    return closeRtmp(rtmpUrl);
}

JNIEXPORT jint JNICALL
Java_com_linciping_rtmputil_RtmpOutputPicture_outputRtmpFramePicture(JNIEnv *env, jclass clazz, jstring rtmp_url,
                                                                     jstring picture_path,
                                                                     jint width, jint height) {
    const char *rtmpUrl = jstringToString(env, rtmp_url);
    const char *picturePath = jstringToString(env, picture_path);
    return outputRtmpFramePicture(rtmpUrl, picturePath, width, height);
}

JNIEXPORT jint JNICALL
Java_com_linciping_rtmputil_RtmpOutputPicture_outputVideoAndPicture(JNIEnv *env, jclass clazz,
                                                                    jstring rtmp_url, jstring output_dir_path,jstring video_name,
                                                                    jint video_time,jint picture_interval,
                                                                    jint width, jint height){
    const char *rtmpUrl = jstringToString(env, rtmp_url);
    const char *outputDirPath = jstringToString(env, output_dir_path);
    const char *videoName = jstringToString(env, video_name);
    return outputVideoAndPicture(rtmpUrl,outputDirPath,videoName,video_time,picture_interval,width,height);
}

JNIEXPORT jint JNICALL
Java_com_linciping_rtmputil_RtmpOutputPicture_outputVideo(JNIEnv *env, jclass clazz,
        jstring rtmp_url, jstring output_video_path,jint video_time,jint width, jint height){
    const char *rtmpUrl = jstringToString(env, rtmp_url);
    const char *outputVideoPath = jstringToString(env, output_video_path);
    return outputVideo(rtmpUrl,outputVideoPath,video_time,width,height);
}
